package com.jiguang.property.controller;


import com.jiguang.property.annotation.Log;
import com.jiguang.property.dto.NoticeInfoDTO;
import com.jiguang.property.service.NoticeInfoService;
import com.jiguang.property.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2025-03-10
 */
@RestController
@RequestMapping("/noticeInfo")
public class NoticeInfoController {
    @Autowired
    private NoticeInfoService noticeInfoService;

    @ApiOperation(value = "获取公告信息列表")
    @PostMapping("list")
    @Log(name = "查询公告消息")
    public Result list(@RequestBody NoticeInfoDTO noticeInfoDTO) {
        return noticeInfoService.listByCriteria(noticeInfoDTO);
    }

    @ApiOperation(value = "新增/编辑公告信息")
    @PostMapping("add")
    @Log(name = "编辑公告操作")
    public Result addOrUpdate(@RequestBody NoticeInfoDTO noticeInfoDTO) {
        return noticeInfoService.addOrUpdateNoticeInfo(noticeInfoDTO);
    }

    @ApiOperation(value = "删除公告信息")
    @PostMapping("delete")
    @Log(name = "编辑公告操作")
    public Result delete(String noticeInfoIds) {
        return noticeInfoService.deleteNoticeInfo(noticeInfoIds);
    }

}

